<%--
  - Author		:	Jaewon Choi
  - Date			:
  - Description	:	
  --%>
<%@ page language="java" %>
<%@ page contentType="text/html; charset=utf-8" %>
<%@ page pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/pages/includes/taglibs.jspf" %>
<%@ include file="/WEB-INF/pages/includes/variables.jspf" %>
<%@ include file="/WEB-INF/pages/includes/doctype.jspf" %>
<html>
	<head>
<%@ include file="/WEB-INF/pages/includes/metatags.jspf" %>
		<title><fmt:message key="pages.title" /></title>
		<link rel="stylesheet" type="text/css" href="<c:url value="${dirStyles}/common.css" />" />
		<link rel="stylesheet" type="text/css" href="<c:url value="${dirScripts}/jqueryUi/css/ui-lightness/jquery-ui-1.8.21.custom.css" />" />

		<script type="text/javascript" src="<c:url value="${dirScripts}/jquery-1.7.2.min.js" />"></script>
		<script type="text/javascript" src="<c:url value="${dirScripts}/jquery-ui-1.8.21.custom.min.js" />"></script>
		<script type="text/javascript">
			$(function() {
				$( ".date" ).datepicker({
					showOn: "both",
					buttonImage: "<c:url value="${dirImages}/calendar.png" />",
					buttonImageOnly: true,
					dateFormat: "yy-mm-dd"
				});
			});
			function goAction(idx){
				if(idx == "" || ! idx){
					return false;
				}
				document.frm.idx.value= idx;
				document.frm.submit();
			}
			
			function goPage(page){
				document.searchFrm.page.value = page;
				document.searchFrm.submit();
			}
		</script>
	</head>
	<body>
		<div class="bodyWrap">
<%@ include file="/WEB-INF/pages/includes/header.jsp" %>
<%@ include file="/WEB-INF/pages/includes/left.jsp" %>
			<div class="contWrap">
				<div class="menuTitle">계정 목록</div>
				<div class="searchWrap">
					<form name="searchFrm" action="<c:url value="/app/list.do" />" method="post">
						<input type="hidden" name="maxnum" value="${maxnum}" />
						<input type="hidden" name="page" value="${page}" />
						<ul  class="lineBlock">
							<li>
								<font>아이디</font>
								<input type="text" name="appId" value="${param.appId}" placeholder="앱 아이디" />
							</li>
						</ul>
						<input class="btn" type="submit" value="검색" />
					</form>
				</div>
				<form name="removeFrm" method="post" action="<c:url value="/app/remove.do" />">
					<input type="hidden" name="fAct" value="remove">
					<input type="hidden" name="maxnum" value="${maxnum}" />
					<input type="hidden" name="page" value="${page}" />
					<input type="hidden" name="searchAppId" value="${param.appId}" />
					<table class="listTbl" border="0">
						<colgroup>
							<col width="68px;" />
							<col width="*" />
							<col width="136px;" />
							<col width="272px" />
							<col width="136px;" />
							<col width="128px;" />
						</colgroup>
						<thead>
							<tr>
								<th><input type="checkbox" onclick="javascript:$('.removeChk').attr('checked', $(this).is(':checked')?true:false);"></th>
								<th>No.</th>
								<th>APP ID</th>
								<th>등록자</th>
								<th>등록일</th>
							</tr>
						</thead>
						<tbody>
							<c:choose>
								<c:when test="${appListTotalCnt ne 0}">
									<c:forEach items="${appList}" var="app" varStatus="stat">
										<tr>
											<td>
												<input type="checkbox" name="idx" class="removeChk" value="${app.idx}">
											</td>
											<td>${appListTotalCnt - stat.index - (maxnum*(page-1))}</td>
											<td onclick="javascript:goAction(${app.idx});">${app.appId}</td>
											<td onclick="javascript:goAction(${app.idx});">${app.createdId}</td>
											<td onclick="javascript:goAction(${app.idx});">${app.createdTime}</td>
										</tr>
									</c:forEach>	
								</c:when>
								<c:otherwise>
									<tr><td colspan="5" style="text-align: center;">데이터가 없습니다.</td></tr>
								</c:otherwise>
							</c:choose>
						</tbody>
					</table>
					<c:if test="${appListTotalCnt ne 0}">
						<div class="pagingWrap">
							<jsp:include page="/WEB-INF/pages/includes/paging.jsp">
								<jsp:param name="totalNum" value="${appListTotalCnt}" />
								<jsp:param name="pageListCnt" value="${maxnum}" />
								<jsp:param name="pageGrpCnt" value="5" />
								<jsp:param name="pageIdx" value="${page}" />
							</jsp:include>
						</div>
					</c:if>
					<input type="button" class="btn" value="삭제" onclick="javascript:if(confirm('선택하신 목록을 삭제하시겠습니까?')){document.removeFrm.submit();}" />
					<input type="button" class="btn" value="등록" onclick="javascript:location.href='<c:url value="/app/form.do" />';" />
				</form>
				<form name="frm" action="<c:url value="/app/form.do" />" method="post" style="display: none;">
					<input type="hidden" name="fAct" value="view">
					<input type="hidden" name="idx" value="">
					<input type="hidden" name="maxnum" value="${maxnum}" />
					<input type="hidden" name="page" value="${page}" />
					<input type="hidden" name="searchAppId" value="${param.appId}" />
				</form>
			</div>
<%@ include file="/WEB-INF/pages/includes/footer.jsp" %>
		</div>
	</body>
</html> 